<template>
	<view class="book-container">
		<view class="book-card" v-for="(item , index) in recordInfos" :key="index">
			<view class="book-header">
				<view class="title-container">
					<view class="book-dept">{{ item.departmentName }}</view>
					<view class="title-bg"></view>
				</view>
			</view>
			<view class="color-gray">
				<view class="book-row">
					<view class="label">就诊医生 ：</view>
					<view class=" flex-start">
						<view>{{item.doctorName }}</view>
						<view v-if="item.jobTitle">{{' ( ' + item.jobTitle +' ) ' }}</view>
					</view>
				</view>
				<view class="book-row">
					<view class="label">就诊院区 ：</view>
					<view class="">{{ item.campusName }}</view>
				</view>
				<view class="book-row">
					<view class="label">就诊时间 ：</view>
					<view class="">{{ item.visitTime }}</view>
				</view>
				<view class="flex-start baseline">
					<view class="label">诊断结果 ：</view>
					<view class="flex-1">
						<text>{{ item.mainTestResults }}</text>
					</view>
				</view>
			</view>
			<view class="book-divider"></view>
			<view class="book-btn-row">
				<button class="book-btn" @click="checkMedicalRecord(item)">查看病历</button>
				<button class="book-btn" @click="toPage(item)">病历邮寄</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			recordInfos: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {}
		},
		methods: {
			checkMedicalRecord(item) {
				uni.navigateTo({
					url: '/pages/Home/ServePatient/PatientMedicalRecordsDetail?item=' + JSON.stringify(item)
				})
			},
			toPage(item) {
				uni.setStorageSync("medicalRecords", item)
				uni.navigateTo({
					url: '/pages/Home/ServePatient/MedicalRecordsNeedKnow'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '../Technology/card.scss'
</style>